﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLBH.DataModel;
using System.Transactions;

namespace QLBH.Model.Controller
{
    public class SoNoController : QLBHEntityBase<SONO>
    {
        public static QLBHEntityBase<SONO> GetInstance()
        {
            return new SoNoController();
        }
        public override void Delete(SONO entity)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    List<LICHSUTHUTRANO> histories = LichSuTraNoController.GetInstance().FindBy(e => e.SONOID == entity.SONOID).ToList();
                    LichSuTraNoController.GetInstance().Deletes(histories);
                    base.Delete(entity);
                    scope.Complete();
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            
        }
    }
}
